/**
 * Category Model
 */
package cn.tonyqiu.wonuly.model;

/**
 * @author <a href="mailto:tony.qiu.smart@gmail.com">Tony Qiu</a>
 *
 */
public class Category extends BaseObject {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6069989409553907223L;

	public static final String INCOME="income";
	public static final String OUTCOME="income";
	
	private Integer id;
	private Integer userId;
	private String name;
	private Integer parent;
	private String type;
	
	/*
	public enum Type {income,outcome};
	*/
	
	/* (non-Javadoc)
	 * @see cn.tonyqiu.wonuly.model.BaseObject#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (!(o instanceof User)) {
			return false;
		}
		final Category c = (Category) o;
		if (c.getId() != null && c.getId().intValue() == id.intValue()) {
			return true;
		}
		return false;
	}

	/* (non-Javadoc)
	 * @see cn.tonyqiu.wonuly.model.BaseObject#hashCode()
	 */
	@Override
	public int hashCode() {
		return id != null ? id.intValue() : 0;
	}

	/* (non-Javadoc)
	 * @see cn.tonyqiu.wonuly.model.BaseObject#toString()
	 */
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("id=" + id).append(":userId="+userId).append(":name=" + name).append(":parent=" + parent)
				.append(":type=" + type);
		return sb.toString();
	}

	/**
	 * @return the id
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the parent
	 */
	public Integer getParent() {
		return parent;
	}

	/**
	 * @param parent the parent to set
	 */
	public void setParent(Integer parent) {
		this.parent = parent;
	}

	/**
	 * @return the type
	 */
	public String getType() {
		return type;
	}

	/**
	 * @param type the type to set
	 */
	public void setType(String type) {
		this.type = type;
	}

	/**
	 * @return the userId
	 */
	public Integer getUserId() {
		return userId;
	}

	/**
	 * @param userId the userId to set
	 */
	public void setUserId(Integer userId) {
		this.userId = userId;
	}

}
